package classes;
import java.io.*;


public class IntexDocument {

  IntexSentence[] m_sents;

  public IntexDocument(ACETokSentDocument aceTSD)
  {
    m_sents = new IntexSentence[aceTSD.m_sents.length];
    for (int i = 0; i < aceTSD.m_sents.length; i++)
      m_sents[i] = new IntexSentence(aceTSD.m_sents[i]);
  }


  public int[] pairsCounts()
  {
    int[] counts = new int[2];
    for (int i = 0; i < m_sents.length; i++) {
      int[] sCounts = m_sents[i].pairsCounts();
      for (int j = 0; j < counts.length; j++)
	counts[j] += sCounts[j];
    }

    return counts;
  }


  public int[] getStats()
  {
    int[] stats = new int[3];
    for (int i = 0; i < m_sents.length; i++) {
      int[] sStats = m_sents[i].getStats();
      for (int j = 0; j < stats.length; j++)
	stats[j] += sStats[j];
    }

    return stats;
  }
 

  public boolean writeInf(String strFile)
  {
    try {
      PrintWriter pw = new PrintWriter(new FileWriter(strFile));
      int crtPairs = 0;
      for (int i = 0; i < m_sents.length; i++)
	crtPairs += m_sents[i].writeInf(pw, crtPairs);
      pw.close();
    }
    catch (IOException e) {
      System.err.println(e);
      return false;
    }

    return true;
  }

}
